package com.beyondsoft.dtc.mobile.automation.base;

/**
 * Created by Robin on 1/28/2016.
 */
public interface GlobalConstants {

	long DEFAULT_PERFORMANCE_DUMP_INTERVAL = 1000;
	long DEFAULT_SCREENSHOT_INTERVAL = 1 * 1000;
	long DEFAULT_MONKEY_TEST_REPEAT_INTERVAL = 300;
	long DEFAULT_MONKEY_TEST_REPEAT_COUNT = 1000;
	long DEFAULT_MONKEY_TEST_PCT_TOUCH = 30;
	long DEFAULT_MONKEY_TEST_PCT_MOTION = 30;
	long DEFAULT_MONKEY_TEST_PCT_APPSWITCH = 20;
	long DEFAULT_MONKEY_TEST_PCT_SYSKEYS = 10;
	long DEFAULT_MONKEY_TEST_PCT_ANYEVENT = 10;

	int DEFAULT_CONNECTION_TIMEOUT = 60 * 1000;

	// unlock screen type
	int UNLOCK_SCREEN_DOWN_UP = 1; // from down to up
	int UNLOCK_SCREEN_LEFT_RIGHT = 2; // from left to right
	int UNLOCK_SCREEN_RIGHT_LEFT = 3; // from right to left
	int UNLOCK_SCREEN_CENTER_RIGHT = 4; // from left to right
	int UNLOCK_SCREEN_CENTER_BOTTOM = 5; // from left to right
	int UNLOCK_SCREEN_BOTTOM_LEFT_RIGHT = 6; // from left to right

	String ADB_COMMAND = "adb";
	String AAPT_COMMAND = "aapt";
	String DEFAULT_ENCODE = "UTF-8";

	String CONFIG_FILE = "/automation_config.properties";
	String UIAUTOMATOR_JAR = "/app/jar/AppAuto.jar";
	String APP_ICON_NAME = "app_icon.png";
	String AUTOMATION_OUTPUT_DIR_NAME = "output";
	String AUTOMATION_LOG_NAME = "result.log";
	String BACKUP_FILE_NAME = "backup.ab";

	String DEFAULT_DEVICE_CONNECTION_TYPE_USB = "usb";
	String DEFAULT_DEVICE_CONNECTION_TYPE_WIFI = "wifi";

	String KEY_AUTOMATION_FEATURES_NAME = "features";

	String KEY_APPIUM_SERVER_PORT = "APPIUM_SERVER_PORT";
	String KEY_APPIUM_BOOTSTRAP_PORT = "APPIUM_BOOTSTRAP_PORT";
	String KEY_APPIUM_CHROMEDRIVER_PORT = "APPIUM_CHROMEDRIVER_PORT";
	String KEY_APPIUM_SELENDROID_PORT = "APPIUM_SELENDROID_PORT";

	String KEY_PACKAGE_PREFIX = "package:";
	String KEY_APPLICATION_PREFIX = "application:";
	String KEY_ACTIVITY_PREFIX = "launchable-activity:";
	String KEY_PACKAGE_NAME = "name=";
	String KEY_VERSION_NAME = "versionName=";
	String KEY_VERSION_CODE = "versionCode=";
	String KEY_PLATFORM_BUILD_VERSION_NAME = "platformBuildVersionName=";
	String KEY_SDK_VERSION = "sdkVersion:";
	String KEY_LABEL = "label=";
	String KEY_ICON = "icon=";
	String KEY_LAUNCHABLE_ACTIVITY = "name=";

	String SYMBOL_SPACE = " ";
	String SYMBOL_TAB = "\t";
	String SYMBOL_QUOTE = "'";
	String SYMBOL_CRLF = "\n";
	String SYMBOL_PCT = "%";
	String SYMBOL_PLUS = "+";
	String SYMBOL_DASH = "-";
	String SYMBOL_COLON = ":";
	String SYMBOL_X = "X";
	String SYMBOL_x = "x";

	String CLASS_TYPE_EDITTEXT = "android.widget.EditText";
	String CLASS_TYPE_TEXTVIEW = "android.widget.TextView";
	String CLASS_TYPE_BUTTON = "android.widget.Button";
	String CLASS_TYPE_VIEW_PAGER = "ViewPager";
	String CLASS_TYPE_SCROLL_VIEW = "ScrollView";

	String KEYWORD_SYSTEM_PACKAGE_NAME = "com.android";

	String[] KEYWORDS_SYSTEM_POPUP_WINDOW = { "install", "ok", "confirm",
			"allow", "agree", "start", "start game", "play", "play game",
			"uninstall", "安装", "好", "确定", "允许", "同意", "开始", "开始游戏", "进行游戏",
			"播放", "删除", "卸载", "继续安装", "我已充分了解该风险，继续安装", "下一步", "点击进入", "进入",
			"跳过", "点击跳过", "清理", "立即清理", "删除", "立即删除", "替换" };

	String[] KEYWORDS_SYSTEM_LOGIN_WINDOW = { "登录", "登陆", "login" };

	enum ElementType {
		TEXT(0), RESOURCE_ID(1), CLASS(2), CHECKED(3), CHECKABLE(4), CONTENTDESC(
				5), CLICKABLE(6), BOUNDS(7), PASSWORD(8);

		private int value;

		ElementType(int value) {
			this.value = value;
		}

		public int getValue() {
			return this.value;
		}
	}

	enum TaskType {
		TASK_BACKUP(1, "backup"), TASK_RESTORE(2, "restore"), TASK_COMPATIBILITY(
				3, "compt"), TASK_CALABASH(4, "calabash"), TASK_LETTUCE(5,
				"lettuce"), TASK_APPIUM_PYTHON(6, "appium_python");

		private int value;
		private String taskName;

		TaskType(int value, String name) {
			this.value = value;
			this.taskName = name;
		}

		public int getValue() {
			return this.value;
		}

		public String getTaskName() {
			return this.taskName;
		}
	}

	enum TaskStatus {
		// STATUS_APK_UPLOADED(1, "APK uploaded."),
		// STATUS_AUTOMATION_REQUEST_OK(2,
		// "send request to automation system ok."),
		STATUS_APK_VERIFIED(3, "APK verified."), STATUS_TEST_SCRIPT_VERIFIED(4,
				"test script verified"), STATUS_DEVICE_CHECKED(5,
				"device status checked."), STATUS_APK_INSTALLED(6,
				"APK installed."), STATUS_APP_STARTED(7, "App started."), STATUS_TESTING_STARTED(
				8, "automation testing started."), STATUS_TESTING_DONE(9,
				"test done");

		private int value;
		private String message;

		TaskStatus(int value, String message) {
			this.value = value;
			this.message = message;
		}

		public int getValue() {
			return this.value;
		}

		public String getMessage() {
			return this.message;
		}
	}

	enum AutomationResult {
		FAILURE(0, "test failure"), SUCCESS(1, "test successful"), ANR(2,
				"ANR error"), CRASH(3, "Crash error");

		private int value;
		private String message;

		AutomationResult(int value, String message) {
			this.value = value;
			this.message = message;
		}

		public int getValue() {
			return this.value;
		}

		public String getMessage() {
			return this.message;
		}
	}

	enum BackupResult {
		SUCCESS(2, "successful"), FAILURE(3, "failure");

		private int value;
		private String message;

		BackupResult(int value, String message) {
			this.value = value;
			this.message = message;
		}

		public int getValue() {
			return this.value;
		}

		public String getMessage() {
			return this.message;
		}
	}
}
